package com.mochasoft.shangchm.type;

import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.TreeSet;

import com.mochasoft.shangchm.stop.Filter;

public abstract class CaiPiao implements ICaiPiao {
	
	 private Map analyzers;
	
	 private Filter filter;
	
	 private int maxNumber;
	
	 private int size;
    //获取一个随机号码
    Integer getRandomNumber(int n) {
    	int number ;
        Random rd=new Random();
        number = rd.nextInt(n)+1;
        return new Integer(number);
    }
    //获取一注随机号码
    TreeSet creatGroupNumbers(Filter filter,int size,int sun){
    	TreeSet group = new TreeSet();
    	Set stop = filter.getStopNumbers();
    	while (true) {
			Integer randomNumber = getRandomNumber(sun);
			if(stop==null){
				group.add(randomNumber);
				break;
			}
			if (!stop.contains(randomNumber)){
				group.add(randomNumber);
			}
			if (group.size() == size)
				break;
		}
    	return group;
    } 
    
    public void setAnalyzers(Map analyzers) {
		this.analyzers = analyzers;
		
	}
    
    public Map getAnalyzers() {
		return this.analyzers;
		
	}

	public void setFilter(Filter filter) {
		this.filter = filter;
		
	}
	
	public Filter getFilter() {
		return this.filter;
		
	}

	public void setMaxNumber(int i) {
		this.maxNumber = i;
		
	}
	
	public int getMaxNumber() {
		return this.maxNumber;
		
	}

	public void setSize(int i) {
		this.size = i;
	}
	
	public int getSize() {
		return this.size;
	}
}
